{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>轮播图列表</h5>
        </div>
        <div class="ibox-content">
            <!--搜索框开始-->           
            <div class="row">
                <div class="col-sm-12">   
                    <div class="col-sm-2" style="width: 100px">
                        <div class="input-group" >
                            <a href="{:url('add')}"><button class="btn btn-outline btn-primary" type="button">添加轮播图</button></a>
                        </div>
                    </div>

                    <div class="table-responsive">
                        <div class="col-sm-12">
                            <form method="post" action="{:url('index')}" id="searchForm" class="form-inline">
                                <!--{:getEnumSelectWidget(config("enum.bannerType"), 'banner_type', '请选择分类', 0, 1)}-->
                                <!--<button class="btn btn-success btn-sm" type="submit" style="margin-bottom:0;margin-left:4px"><i class="fa fa-filter"></i> 筛选</button>
                                <a class="btn btn-primary btn-sm"  style="margin-bottom:0" href="{:url('index')}"><i class="fa fa-filter"></i> 重置</a>-->
                            </form>
                        </div>
                    </div>

                </div>
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="table table-bordered table-hover">
                        <thead>
                            <tr class="long-tr">
                                <th>标题</th>
                                <th>图片</th>
                                <th>类型</th>
                                <th>跳转路由</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="list-content">
                            {foreach $list as $vo}
                                <tr class="long-td">
                                    <td>{$vo.title}</td>
                                    <td>
                                        <div class="layer-photos-demo">
                                            <img src="{$vo.img}" style="width:80px" />
                                        </div>
                                    </td>
                                    <td>{:getEnumString(config('enum.bannerType'), $vo['type'])}</td>
                                    <td>{$vo.target_route}</td>
                                    <td>
                                        {if condition="$vo['status'] eq 1"}
                                            <a class="red" href="{:url('deactivate',['id' => $vo['id']])}">
                                                <div><span class="label label-info">已上架</span></div>
                                            </a>
                                        {else /}
                                            <a class="red" href="{:url('activate',['id' => $vo['id']])}">
                                                <div><span class="label label-danger">已下架</span></div>
                                            </a>
                                        {/if}
                                    </td>
                                    <td>
                                        <a href="{:url('edit',['id'=>$vo['id'],'type'=>$vo['type']])}" class="btn btn-primary btn-xs">
                                            <i class="fa fa-edit"></i> 编辑</a>&nbsp
                                        <a class="btn btn-danger btn-xs" href="{:url('delete',['id' => $vo['id']])}">
                                            <i class="fa fa-trash-o"></i> 删除</a>
                                    </td>
                                </tr>
                            {/foreach}
                        </tbody>
                    </table>
                    <div id="laypage">
                        {$list->render()}
                    </div>
                </div>
            </div>
            <!-- End Example Pagination -->
        </div>
    </div>
</div>
<!-- End Panel Other -->
</div>
<script type="text/javascript" src="/static/admin/js/laypage.js"></script>
{include file="public/footer" /}
<script type="text/javascript">
layer.photos({
  photos: '.layer-photos-demo'
//  ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
});

layui.use(['laypage', 'layer'], function(){
  var laypage = layui.laypage
  ,layer = layui.layer;

  //完整功能
  laypage.render({
    elem: 'laypage'
    ,count: '{$list->total()}' // 总数据条数
    ,curr: '{$list->currentPage()}' // 当前第几页
    ,limit: '{$list->listRows()}'   // 每页显示条数
    ,layout: ['count', 'prev', 'page', 'next', 'refresh', 'skip']
    ,jump: function(obj, first){
      //首次不执行
      if(!first){
            $("#searchForm").attr('action', '{:url("index")}?page='+obj.curr);
          $("#searchForm").submit();
      }
    }
  });
});
</script>

</body>
</html>